package com.gxgeek.springfeaturesstudy;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import javax.annotation.PostConstruct;

/**
 * @author gaoxing
 * @create 2017-11-07 下午4:39
 */
@Slf4j
public class InitBean3 implements BeanNameAware,BeanFactoryAware,ApplicationContextAware,InitializingBean,CommandLineRunner,ApplicationRunner/*,BeanFactoryPostProcessor*/ {
    public InitBean3() {
      log.info("bean3 初始化");
    }


    @Override
    public void setBeanName(String s) {
        log.info("bean3 setBeanName");

    }
    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        log.info("bean3 setBeanFactory");

    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        log.info("bean3 setApplicationContext");

    }

    @PostConstruct
    public void postConstruct(){
        log.info("bean3 postConstruct");

    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("bean3 afterPropertiesSet");

    }

    @Override
    public void run(String... args) throws Exception {
        log.info("bean3 CommandLineRunner");

    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("bean3 ApplicationRunner");

    }
//
//    @Override
//    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
//        log.info("bean3 postProcessBeanFactory");
//
//    }
}
